<?php

/**
 * BonCommandeClient filter form base class.
 *
 * @package    SdCommerce
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseBonCommandeClientFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'date'                    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'date_livraison'          => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'reference'               => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'observation'             => new sfWidgetFormFilterInput(),
      'date_echeance'           => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'duree_validite'          => new sfWidgetFormFilterInput(),
      'id_modepaiement'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ModalitePaiement'), 'add_empty' => true)),
      'is_devis'                => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'echance_cb'              => new sfWidgetFormChoice(array('choices' => array('' => '', 'Jours' => 'Jours', 'Semaines' => 'Semaines', 'Mois' => 'Mois', 'Années' => 'Années'))),
      'id_client'               => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Client'), 'add_empty' => true)),
      'id_employer'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Employe'), 'add_empty' => true)),
      'duree_echance'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'valider'                 => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'id_departement'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Departement'), 'add_empty' => true)),
      'numero_sequence'         => new sfWidgetFormFilterInput(),
      'bon_livraison_client_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('BonLivraisonClient'), 'add_empty' => true)),
      'created_at'              => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'              => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'date'                    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'date_livraison'          => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'reference'               => new sfValidatorPass(array('required' => false)),
      'observation'             => new sfValidatorPass(array('required' => false)),
      'date_echeance'           => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'duree_validite'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'id_modepaiement'         => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('ModalitePaiement'), 'column' => 'id')),
      'is_devis'                => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'echance_cb'              => new sfValidatorChoice(array('required' => false, 'choices' => array('Jours' => 'Jours', 'Semaines' => 'Semaines', 'Mois' => 'Mois', 'Années' => 'Années'))),
      'id_client'               => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Client'), 'column' => 'id')),
      'id_employer'             => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Employe'), 'column' => 'id')),
      'duree_echance'           => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'valider'                 => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'id_departement'          => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Departement'), 'column' => 'id')),
      'numero_sequence'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'bon_livraison_client_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('BonLivraisonClient'), 'column' => 'id')),
      'created_at'              => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'              => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('bon_commande_client_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'BonCommandeClient';
  }

  public function getFields()
  {
    return array(
      'id'                      => 'Number',
      'date'                    => 'Date',
      'date_livraison'          => 'Date',
      'reference'               => 'Text',
      'observation'             => 'Text',
      'date_echeance'           => 'Date',
      'duree_validite'          => 'Number',
      'id_modepaiement'         => 'ForeignKey',
      'is_devis'                => 'Boolean',
      'echance_cb'              => 'Enum',
      'id_client'               => 'ForeignKey',
      'id_employer'             => 'ForeignKey',
      'duree_echance'           => 'Number',
      'valider'                 => 'Boolean',
      'id_departement'          => 'ForeignKey',
      'numero_sequence'         => 'Number',
      'bon_livraison_client_id' => 'ForeignKey',
      'created_at'              => 'Date',
      'updated_at'              => 'Date',
    );
  }
}
